package com.xiaoyu.lanling.feature.moment.model

import `in`.srain.cube.request.JsonData
import com.xiaoyu.base.model.User

class Comment(val id: String, val content: String, val replyTo: User, val time: String) {

    companion object {
        fun fromJson(jsonData: JsonData): Comment {
            val id = jsonData.optString("id")
            val content = jsonData.optString("text")
            val replyTo = User.fromJson(jsonData.optJson("user"))
            val time = jsonData.optString("time")
            return Comment(id, content, replyTo, time)
        }
    }
}